import { BASE_HOST, HOST_URL } from "../../config/index"


Component({
  data: {
    top: 0,
    loveImgUrl: BASE_HOST + '/card/love/',
    status: 0,
    whoObj: {
      id: 0,
      name: 'WHO',
    },
    doObj: {
      id: 0,
      name: 'DO',
    }
  },
  lifetimes: {
    attached() {
      const { statusBarHeight } = wx.getWindowInfo()
      this.setData({
        top: statusBarHeight,
      })
    },
  },
  methods: {
    goback() {
      wx.navigateBack()
    },
    clickStart() {
      if (this.data.status == 2) {
        this.setData({
          status: 0,
        })
        return
      }
      this.setData({
        status: 1,
      })
      wx.request({
        url: HOST_URL + 'love/getone',
        method: 'GET',
        data: {
        },
        success: (res: any) => {
          console.log(res)
          this.setData({
            whoObj: res.data.data.who,
            doObj: res.data.data.do,
          })
        },
      })
      setTimeout(() => {
        this.setData({
          status: 2,
        })
      }, 2000);
    },

  },
})
